package com.nervenets.web.controller.handler.admin.setting;

import com.nervenets.web.controller.handler.SessionHandler;
import com.nervenets.web.enumeration.Role;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;

/**
 * Created by joe on 17-3-29.
 */
public class GlobalRuleEditHandler extends SessionHandler<GlobalRuleParams> {
    @Override
    public ArrayList<Role> allowRoles() {
        return Role.administrator();
    }

    @Override
    public boolean needLog() {
        return true;
    }

    @Override
    public String handle(GlobalRuleParams params, HttpServletRequest request) throws Exception {
        globalVariablesService.setGlobalRule(params.toGlobalRule());
        return successMessage();
    }

    @Override
    public String result() throws Exception {
        return null;
    }
}
